<template>
    <swiper>
        <swiper-item v-for="(item,index) in banner"  :key="index">
            <a :href ="item.link">
                <img :src="item.image" alt="" @load="isload">
            </a>
        </swiper-item>
    </swiper>
</template>

<script>
    import {Swiper, SwiperItem} from '../../../components/common/swiper/index'

    export default {
        name: "HomeSwiper",
        props:{
          banner:{
              type: Array,
              data() {
                  //返回默认值指定为数组
                  return []
              }
          }
        },
        data(){
           return {
               isLoad:false
           }
        },
        methods:{

            isload(){
                //自己定义一个防抖功能 减少发送次数
                if(!this.isLoad){
                    this.$emit('swiperImgLoad')
                    this.isLoad = true
                }else{

                }

            }
        },
        components:{
            SwiperItem,
            Swiper
        }
    }
</script>

<style scoped>

</style>